<cfcomponent output="false" extends="validateThis.server.AbstractServerRuleValidator" hint="I am responsible for performing the Boolean validation.">

	<cffunction name="validate" returntype="any" access="public" output="false" hint="I perform the validation returning info in the validation object.">
		<cfargument name="validation" type="any" required="yes" hint="The validation object created by the business object being validated." />
		<cfargument name="locale" type="string" required="yes" hint="The locale to use to generate the default failure message." />

        <cfscript>
			var base = new assets.calgrants.com.Base();
            //var currentYear = listLast(base.getCurrentProgramYear(), '-');
            var args = [arguments.validation.getPropertyDesc()];
            var holidaysDuringRange = arrayNew(1);
            /*holidaysDuringRange[1][1] = '1/1/' & currentYear;
            holidaysDuringRange[1][2] = "New Year's Day";*/
			var workshopHolidays = base.getWorkshopHolidays();
			var lc = 1;
			for (var i=1; i lte ArrayLen(workshopHolidays); i++) {
				if (workshopHolidays[i]["forbid"] eq "true") {
					holidaysDuringRange[lc][1] = DateFormat(workshopHolidays[i]["holiday"], "m/d/yyyy");
					holidaysDuringRange[lc][2] = workshopHolidays[i]["name"];
					lc = lc + 1;
				}
			}
        </cfscript>

		<cfif shouldTest(arguments.validation)>

            <cfset var i = 0 />
            <cfset var matchFound = false />

            <cfloop from="1" to="#arrayLen(holidaysDuringRange)#" index="i">
                <cfif dateCompare(arguments.validation.getObjectValue(), holidaysDuringRange[i][1]) EQ 0>
                    <cfset matchFound = true />
                    <cfbreak />
                </cfif>
            </cfloop>

            <cfif matchFound>
			    <cfset fail(arguments.validation, arguments.validation.getPropertyDesc() & " lands on " & holidaysDuringRange[i][2]) />
            </cfif>
		</cfif>
	</cffunction>
	
</cfcomponent>
	

